package com.capgemini.wechat.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.capgemini.core.PageList;
import com.capgemini.remind.pojo.OrderInfo;
import com.capgemini.wechat.mapper.SaleOrderMapper;

/**
 * 
 * @author
 * @date
 */
@Service
public class SaleOrderService {
	@Autowired
	private SaleOrderMapper saleOrderMapper;

	public void queryOrderInfoForPage(final PageList<OrderInfo> page){
        List<String> orderIds = saleOrderMapper.queryOrderIdByDealerNumAndCustomerIdForPage(page);

        if(!orderIds.isEmpty()){
            page.setItems(saleOrderMapper.queryOrderByOrderIds(orderIds));
        }
    }

    /**
     * 根据订单信息，统计当日有导入订单客户的年消费信息及最后一次消费信息
     *
     */
    public void processSaleOrderInfoForToday(){
        saleOrderMapper.processSaleOrderInfo();
    }

    /**
     * 根据订单信息，统计所有客户的年消费信息及最后一次消费信息
     *
     */
    public void processSaleOrderInfoForAll(){
        saleOrderMapper.processAllSaleOrderInfo();
    }

    /**
     * 维护客户与系统预定义客户分类的关系
     *
     */
    public void refreshCustomerRelGroup(){
        saleOrderMapper.refreshCustomerRelGroup();
    }

}
